{% extends 'base.html' %}

{% block title %}重置用户密码{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header bg-warning text-dark">
                    <h4 class="mb-0">
                        <i class="fas fa-exclamation-triangle"></i>
                        重置用户密码
                    </h4>
                </div>
                <div class="card-body">
                    <div class="alert alert-warning" role="alert">
                        <strong>警告：</strong>您即将为用户生成一个临时密码。此操作将：
                        <ul class="mt-2 mb-0">
                            <li>生成一个24小时有效的临时密码</li>
                            <li>用户使用临时密码登录后将被强制修改密码</li>
                            <li>临时密码只能使用一次</li>
                        </ul>
                    </div>
                    
                    <div class="user-info mb-4">
                        <h5>用户信息：</h5>
                        <table class="table table-sm">
                            <tr>
                                <td><strong>用户名：</strong></td>
                                <td>{{ target_user.username }}</td>
                            </tr>
                            <tr>
                                <td><strong>邮箱：</strong></td>
                                <td>{{ target_user.email|default:"未设置" }}</td>
                            </tr>
                            <tr>
                                <td><strong>姓名：</strong></td>
                                <td>{{ target_user.get_full_name|default:"未设置" }}</td>
                            </tr>
                            <tr>
                                <td><strong>注册时间：</strong></td>
                                <td>{{ target_user.date_joined|date:"Y-m-d H:i" }}</td>
                            </tr>
                            <tr>
                                <td><strong>最后登录：</strong></td>
                                <td>{{ target_user.last_login|date:"Y-m-d H:i"|default:"从未登录" }}</td>
                            </tr>
                        </table>
                    </div>
                    
                    <form method="post">
                        {% csrf_token %}
                        <div class="d-flex justify-content-between">
                            <a href="{% url 'admin:auth_user_changelist' %}" class="btn btn-secondary">
                                <i class="fas fa-arrow-left"></i> 取消
                            </a>
                            <button type="submit" class="btn btn-warning">
                                <i class="fas fa-key"></i> 确认重置密码
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}